/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pclong.fightlandlordserver;

import java.io.File;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;

/**
 *
 * @author long@7road.com
 * 实现配置管理
 */
public class ConfigFileManager {

    private static ConfigFileManager Instance;

    /**
     * Get the value of Instance
     *
     * @return the value of Instance
     */
    public static ConfigFileManager getInstance() {
        if (ConfigFileManager.Instance == null) {
            ConfigFileManager.Instance = new ConfigFileManager();
        }
        return Instance;
    }

    public static void ReloadTankAgentConfig(String fileName) throws Exception {
        Serializer serializer = new Persister();
        File file = new File(fileName);
        if (file.exists()) {
            TankAgentConfigEntity.setInstance(serializer.read(TankAgentConfigEntity.class, file));
        }

    }

    /**
     * Set the value of Instance
     *
     * @param Instance new value of Instance
     */
    public static void setInstance(ConfigFileManager Instance) {
        ConfigFileManager.Instance = Instance;
    }
    public String TankAgentConfigFile;
    public String ExtraConfigFile;
    public String ListenerConfigDir;

    public ConfigFileManager() {
        TankAgentConfigFile = "";
        ExtraConfigFile = "";
        ListenerConfigDir = "";
    }
}
